package FileIO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 故我
 * Date: 2023-10-18
 * Time: 17:02
 */
public class IODemo6 {
    public static void main(String[] args) throws IOException {
        // InputStream对象 读取文件操作
        InputStream inputStream = new FileInputStream("e:/IO/1.txt");
//        while(true){
//            int ret = inputStream.read();
//            if(ret < 0){
//                break;
//            }
//            System.out.printf("%x ",ret);
//        }

        while(true){
            byte[] buffer = new byte[1024];
            int ret = inputStream.read(buffer);
            if(ret == -1){
                break;
            }
            for(int i=0;i<ret;i++){
                System.out.printf("%x ",buffer[i]);
            }
        }
        inputStream.close();
    }
}
